package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 经验要求枚举枚举
 * @author helong
 */
@Getter
public enum ExperienceEnum {

    FRESH_GRADUATE(0, "应届生"),
    ONE_TO_THREE_YEARS(1, "1-3年"),
    THREE_TO_FIVE_YEARS(2, "3-5年"),
    MORE_THAN_FIVE_YEARS(3, "5年以上");



    private final Integer value;
    private final String text;

    // 构造函数
    ExperienceEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static ExperienceEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (ExperienceEnum experienceEnum : ExperienceEnum.values()) {
            if (experienceEnum.getValue().equals(value)) {
                return experienceEnum;
            }
        }
        return null;
    }
}
